// Programming_Scala/src/ch13/http-enum2-script.scala

object HttpMethod extends Enumeration {
  type Method = Value
  val Connect = Value( 100, "Connect" )
  val Delete = Value( "Delete" )
  val Get = Value( 200, "Get" )
  val Head = Value( "Head" )
  val Options = Value( 300, "Options" )
  val Post = Value( "Post" )
  val Put = Value( "Put" )
  val Trace = Value( "Trace" )
}

import HttpMethod._

def doPrintln( method: HttpMethod.Method ): Unit = {
  println( method + ": " + method.id )
}

def handle( method: HttpMethod.Method ) = method match {
  case Connect => doPrintln( method )
  case Delete => doPrintln( method )
  case Get => doPrintln( method )
  case Head => doPrintln( method )
  case Options => doPrintln( method )
  case Post => doPrintln( method )
  case Put => doPrintln( method )
  case Trace => doPrintln( method )
}

// HttpMethod foreach { method => handle( method ) }
HttpMethod foreach { yam => handle( yam ) }
println( HttpMethod )
